package com.ocom.srvpaccess.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ocom.common.dto.MachInfoDto;
import com.ocom.common.entity.access.EntityMjDeviceInfo;

import java.util.List;


/**
 * 门禁信息
 */
public interface MjDeviceInfoService extends IService<EntityMjDeviceInfo> {

    // 从设备信息表mj_device_info找到com_id ，device_no匹配的记录
    public EntityMjDeviceInfo getDeviceInfo(Long companyId, String machNo);

    // 3、根据machNo从门禁设备表mj_device_info（连表门禁区域表mj_area_info、门禁片区表mj_region_info）
    // 查找machID、machName、areaNo、areaName、regionID、regionName。
    public MachInfoDto selectmachNo(Long companyId, String machNo);

    //1.如果versionCode 不为空且不等于mj_device_info . app_ver：修改app_ver
    public void updateAppVer(Long companyId, String machNo,String versionCode);

    //修改门禁设备表mj_device_info中com_id、device_no匹配的记录
    public void changeMachParaState(Long companyId, String machNo, String jobId);


    // zone_ver_last = zone_ver
    public void updateZoneVerLast(Long companyId,String machNo, String zoneVer);

    // zone_ver_tab = zone_ver_last
    public void updateZoneVerTab(Long companyId,String machNo, String zoneVerLast);

    /**
     * 1、修改门禁设备表mj_device_info中com_id、device_no匹配的记录：
     * */
    public void updateRsaState(Long companyId, String machNo,String jobId);


    /**
     * 2、如果perGroupNum=0：mj_device_info . group_var_last = mj_device_info . group_ver
     * */
    public void updateGroupVarLast(Long companyId, String machNo,String groupVer);


    /**
     * 如果没有记录：mj_device_info . group_var_tab = mj_device_info . group_ver_last，返回NULL
     * */
    public void updateGroupVarTab(Long companyId, String machNo,String groupVerLast);

    //1从设备信息表mj_device_info找到com_id ，device_no匹配的记录得到areaNo。
    public EntityMjDeviceInfo selectAreaNo(Long companyId, String machNo);

    public void updateDeviceInfo(Long companyId,String machNo,Long listAddTab,Long listDeleteTab,Long maxId);

    public void updateListDel(Long companyId,String machNo,Long listAddTab,Long maxId);

    //update mj_device_info set list_delete = list_delete_tab where device_id=[deviceId]
    public void updateListDelDeviceId(Long companyId,Long deviceId,Long listDeleteTab);


    public void updateListAdd(Long companyId,String machNo,Long listDeleteTab,Long maxId);

    public void updateListAddDeviceId(Long companyId,Long listAddTab,Long deviceId);
    //5、没有新的操作：修改mj_device_info表：
    //list_add_tab=-1
    //list_delete_tab=-1
    //list_State=2
    public void updatePerNo(Long companyId, String machNo);


    public void updateAppVerLast(Long companyId,String machNo, String AppVerTab);

    //修改Jobid数据
    public void updateJobId(Long companyId, String machNo, Long jobId);

    //修改 list_State=2
    public void updateListStateTwo(Long companyId,Long deviceId);
    //修改 list_State=1
    public void updateListStateOne(Long companyId,Long deviceId);


    //
    //修改分库库mj_device_info表：
    //	update mj_device_info
    //set status=0, end_time = EndDate
    //				where com_id= companyId and device_no=machNo
    public void updateEndTime(Long companyId,String machNo);

    public  void updateCommTimeCommMode(Long companyId,String machNo, Integer commMode);

    int selectMachCount(Long comId, Integer regionId, Integer areaId);

    int selectAreaId(Long companyId, String machNo);

    List<String> getCenterMachByCompanyId(Long companyId);
}
